Skip to content

Add decode command for event, message and constructor data decoding#481

Merged
ascjones merged 22 commits intomasterfrom
ag-decode-cmd
Apr 12, 2022
Merged

Add decode command for event, message and constructor data decoding#481
ascjones merged 22 commits intomasterfrom
ag-decode-cmd

Conversation

@agryaznov
Copy link
Contributor

@agryaznov agryaznov commented Mar 29, 2022

As a response to user feature request (e.g. like in this StackExchange question):

  1. New command added which allows to decode data from contract events and messages
  2. Corresponding encoded values printing added to debug log (where there was lack of such)

Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple of nitpicks, and also we need to add constructor decoding

Co-authored-by: Andrew Jones <ascjones@gmail.com>
@agryaznov agryaznov changed the title Add decode command for event and message data decoding Add decode command for event, message and constructor data decoding Apr 8, 2022
@agryaznov agryaznov requested a review from ascjones April 8, 2022 11:08
Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +75 to +79
fn cargo_contract(path: &Path) -> assert_cmd::Command {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.current_dir(path).arg("contract");
cmd
}
Copy link
Contributor

@athei athei Apr 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to compile cargo contract here. So you essentially want to run cargo run --release -- <args> here. You can get the correct directory where to run it by reading CARGO_MANIFEST_PATH env var.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that assert_cmd assumes it is an integration test (therefore the binary would already have been built).

I've moved this test to integration test to see if it works now.

@agryaznov agryaznov requested a review from a team as a code owner April 12, 2022 08:34
@ascjones ascjones merged commit bce9301 into master Apr 12, 2022
@ascjones ascjones deleted the ag-decode-cmd branch April 12, 2022 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants